<?php
defined('BASEPATH') or exit('No direct script access allowed');

//通用错误
const STATUS_OK = 0; //成功
const STATUS_NO = 1; //失败
const REQUEST_ERR = 2; //请求错误
const PARAM_ERR = 3; //参数错误
const SYSTEM_ERR = 4; //系统错误
const SIGN_ERR = 5; //签名错误
const PAGE_NOT_FOUND = 6; //404

//数据错误
const INSERT_ERR = 10001; //数据插入错误
const DELETE_ERR = 10002; //数据删除错误
const UPDATE_ERR = 10003; //数据更新错误
const SELECT_ERR = 10004; //数据查询错误

//用户相关
const SMS_ERR = 20001;  // 验证码发送失败
const SMS_CHECK_ERR = 20002; // 验证码验证错误
const NO_LOGIN = 901; // 未登录
const NO_USER = 902;
const ERROR_PASSWORD = 903;
const NO_ALLOW = 20004; // 不允许请求别人的信息
const USER_DUC = 904;
const NOT_COUPON = 905;

// 书籍相关
const NOVEL_NOT_FOUNE = 20001;
const CHAPTER_NOT_FOUND = 20002;
const NOVEL_SHELF_DUC = 200003;

//错误信息
$config['msg_map'] = array(
    //通用错误码
    STATUS_OK => array(
        'en' => 'success',
        'cn' => '成功',
    ),
    STATUS_NO => array(
        'en' => 'error',
        'cn' => '失败',
    ),
    PAGE_NOT_FOUND => array(
        'en' => 'page not found',
        'cn' => '找不到该页面',
    ),
    REQUEST_ERR => array(
        'en' => 'request error',
        'cn' => '请求错误',
    ),
    PARAM_ERR => array(
        'en' => 'param error',
        'cn' => '参数错误',
    ),
    SYSTEM_ERR => array(
        'en' => 'system error',
        'cn' => '系统错误',
    ),
    SIGN_ERR => array(
        'en' => 'sign error',
        'cn' => '签名错误',
    ),

    //数据错误
    INSERT_ERR => array(
        'en' => 'data insertion error',
        'cn' => '数据插入失败',
    ),
    DELETE_ERR => array(
        'en' => 'data deletion error',
        'cn' => '数据删除错误',
    ),
    UPDATE_ERR => array(
        'en' => 'data update error',
        'cn' => '数据更新错误',
    ),
    SELECT_ERR => array(
        'en' => 'data query error',
        'cn' => '数据查询失败',
    ),

    // 用户相关
    SMS_ERR => array(
        'en' => 'send sms error',
        'cn' => '验证码发送失败',
    ),
    SMS_CHECK_ERR => array(
        'en' => 'check code error',
        'cn' => '验证码验证错误',
    ),
    NO_LOGIN => array(
        'en' => 'no login',
        'cn' => '用户未登录',
    ),
    NO_ALLOW => array(
        'en' => 'no allow',
        'cn' => '无权访问',
    ),
    NO_USER => array(
        'en' => 'user not found',
        'cn' => '用户不存在',
    ),
    USER_DUC => array(
        'en' => 'user has reg',
        'cn' => '用户已存在',
    ),

    // 书籍相关
    NOVEL_NOT_FOUNE => array(
        'en' => 'novel not found',
        'cn' => '书籍不存在',
    ),

    CHAPTER_NOT_FOUND => array(
        'en' => 'chapter not found',
        'cn' => '章节不存在',
    ),
);
